# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lksctp-tools
pkgver=1.0.19
pkgrel=5
pkgdesc="User-space access to Linux Kernel SCTP"
url="https://lksctp.sourceforge.net/"
arch="all"
options="!check"  # sctp_connectx in v4test fails on kernel 4.14
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
depends_dev="linux-headers"
makedepends="$depends_dev libtool automake autoconf"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc lib${pkgname%-tools}:libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/sctp/lksctp-tools/archive/v$pkgver.tar.gz"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	cd "$builddir"/src/func_tests
	make v4test
	make v6test
}

package() {
	make DESTDIR="$pkgdir" install
}

libs() {
	default_libs
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lksctp-tools "$subpkgdir"/usr/lib
}

sha512sums="
e56a4b00206acfb88cab1b8fc7424a1a4996f67ef925c29a97395c44c57f2cbcb3fc36ec2648f5e5a5ce29d8d61ee1f7a5e7869e6bbd68bff85590b6ec521883  lksctp-tools-1.0.19.tar.gz
"
